package com.weayer.service;

import com.weayer.dto.ResponseResult;
import com.weayer.mapper.DriverUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description: Service服务 - 司机 - 城市司机管理Service
 * @author: Weayer
 **/
@Service
public class CityDriverService {
    @Autowired
    DriverUserMapper driverUserMapper;

    /**
     * @Description: 根据城市，查询当前城市是否有司机
     * @Param: [cityCode]
     * @return: com.weayer.dto.ResponseResult<java.lang.Boolean>
     **/
    public ResponseResult<Boolean> isAvailableDriver(String cityCode){
        int count = driverUserMapper.selectCountByCityCode(cityCode);
        if(count == 0){
            return ResponseResult.fail(false);
        }else{
            return ResponseResult.success(true);
        }
    }
}
